package cn.fxl.hstrix;

import cn.fxl.domain.User;
import cn.fxl.feignclient.UserClient;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserFeignClientFallbackFactory implements FallbackFactory<UserClient> {
    @Override
    public UserClient create(Throwable throwable) {
        return new UserClient() {
            @Override
            public User getById(Long id) {
                return new User(-1L,"熔断","兜底数据");
            }
        };
    }
}
